def ans(w):
    line = []
    for i in w:
        if i in '([{<':
           line.append(i)
        elif i in ')]}>':
            if not line:
                return False
            if i == ')' and line[-1] == '(':
                line.pop()
            elif i == ']' and line[-1] == '[':
                line.pop()
            elif i == '}' and line[-1] == '{':
                line.pop()
            elif i == '>' and line[-1] == '<':
                line.pop()
            else:
                return False
    return not line


print(ans(input('Ввод: ')))